import { Pie } from '@antv/g2plot';
import { useEffect } from 'react';

const data = [
  {
    type: '正常',
    value: 11,
  },
  {
    type: '异常',
    value: 1,
  },
];

const ComparePieChart = () => {
  useEffect(() => {
    const piePlot2 = new Pie('container6', {
      forceFit: true,
      title: {
        visible: true,
        text: '车辆状态图',
      },
      description: {
        visible: true,
        text: '车辆是否异常，可以可视化查看',
      },

      radius: 0.8,
      data,
      angleField: 'value',
      colorField: 'type',
      label: {
        visible: true,
        type: 'inner',
      },
    });

    piePlot2.render();
  }, []);
  return <div id="container6"></div>;
};

export default ComparePieChart;
